#ifndef __ENC_DEC_H__
#define __ENC_DEC_H__

#include "cnf.h"
#include "clause.h"
#include "var.h"
enum MESSAGE_TYPE {
    MSG_ASSIGN_NEW_CLS,     //assign new clause from M to S
    MSG_ASSIGN_CNF,         //assign brand new cnf from M to S
    MSG_FOUND_SOLUTION,     //found a solution, send to master
    MSG_CONFLICT_DEAD,      //conflict happened, send to master
    MSG_ENCODED_CLAUSES,    //several clauses, send from S to M or M to S
    MSG_ENCODED_CNF,        //the whole cnf, send from S to M or M to S
    MSG_ENCODED_VARS,       //send all variables from S to M, or M to S
    MSG_STOP_ALL,           //stoped by M to S
};

typedef struct _metadata{
    char type;
    unsigned datalen;
}metadata;

unsigned* encode_variables(variable* vars, int num_var, int num_assigned);
variable* decode_variables(unsigned* encoded, int enc_len);
#endif